home *** CD-ROM | disk | FTP | other *** search
- /*----------------------------------------------------------------------------*\
- *
- * IIIIIII SSSSSS
- * II SS InstallShield (R)
- * II SSSSSS (c) 1990-1996, Stirling Technologies, Inc.
- * II SS All Rights Reserved.
- * IIIIIII SSSSSS
- *
- *
- * This source code is intended as a supplement to InstallShield Corporation
- * product documentation. Refer to your InstallShield Corporation
- * product documentation for more detailed information.
- *
- *
- * File Name: SETUP.RUL
- *
- * Description: InstallShield SDK Edition Template One script.
- *
- *
- *
- *
- * Author: InstallShield Corporation Date: 1-10-96
- *
- * Comments: This template script performs a basic installation to a
- * Windows 95 or Windows NT platform. The installation
- * includes components: Application Program Files, Sample and
- * Template Files, Online Help Files, and Multimedia Tutorial
- * Files. With minor modifications, this template can be
- * adapted to create new, customized installations.
- *
- * There maybe small differences between this script and the
- * script shown in the on-line User's Guide
- *
- *
- \*----------------------------------------------------------------------------*/
-
-
-
- // Size of components.
- #define SIZE_REQ_SAMPLES 82000
- #define SIZE_REQ_TEMPLATES 2000
- #define SIZE_REQ_PROGRAM 1660000
-
- #define APP_NAME "CGI*Star_new"
- #define PROGRAM_GROUP_NAME "WebGenie"
- #define APPBASE_PATH "WebGenie\\"
- #define COMPANY_NAME "WebGenie"
- #define PRODUCT_NAME "CGI*Star"
- #define PRODUCT_VERSION "2.2"
- #define PRODUCT_KEY "cgistar.exe"
- #define UNINSTALL_KEY "U_CGISTAR"
- #define APPBASE_DIR95 "Program Files"
- #define BASE_REGISTRYNT "Software\\Microsoft\\Windows NT\\CurrentVersion\\App Paths\\"
- #define BASE_REGISTRY95 "Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"
-
- #define STR_COMPLETE95 "by selecting the program icon in the Programs menu.\n\n"
- #define STR_COMPLETENT "by selecting the program icon in the program group.\n\n"
-
- declare
-
- // Global variable declarations.
- STRING svGrp, szMsg, szFileSet, szTitle, szAppPath, szAppSharedDir;
- STRING szProgram, szTemp, svUninstLogFile, szRegKey;
- STRING svMainDirectory[ _MAX_STRING ];
- BOOL bSpaceOk, bReshowSetupType;
- NUMBER nResult, nStatusId, nType;
-
- BOOL bIncludeProgram, bIncludeSamples, bIncludeHelp;
- BOOL bWinNT, bShellExplorer;
-
- // Function declarations.
- prototype SetupScreen();
- prototype CheckRequirements();
- prototype CheckSpaceRequirements( number, number, number, string );
- prototype CreateRegDBEntries();
-
- program
-
- StartHere:
- Disable( BACKGROUND );
-
- // Set up the installation screen.
- SetupScreen();
-
- // Set installation info., which is required for registry entries.
- InstallationInfo( COMPANY_NAME, PRODUCT_NAME, PRODUCT_VERSION, PRODUCT_KEY );
-
- // Create a Welcome dialog.
- WelcomeDlg:
- Disable( BACKBUTTON );
- Welcome( "", 0 );
- Enable( BACKBUTTON );
-
- // Test target system proper configuration.
- CheckRequirements();
-
- // Ask user for a destination location for the installation.
- GetTargetDirectory:
-
- svMainDirectory = TARGETDISK ^ APPBASE_DIR95 ^ APPBASE_PATH;
-
- szMsg = "";
- if ( AskDestPath( "", szMsg, svMainDirectory, 0 ) = BACK ) then
- goto WelcomeDlg;
- endif;
-
- szAppSharedDir = svMainDirectory ^ "System";
-
- nType = TYPICAL;
- DetermineUserSelection:
-
- nType = SetupType( "", "", svMainDirectory, nType, 0 );
- if ( nType = BACK ) then goto GetTargetDirectory; endif;
-
- bReshowSetupType = FALSE;
-
- switch (nType)
- case TYPICAL:
- bIncludeSamples = TRUE;
- bIncludeProgram = TRUE;
- bIncludeHelp = TRUE;
- case COMPACT:
- bIncludeProgram = TRUE;
- case CUSTOM:
- bIncludeSamples = TRUE;
- bIncludeProgram = TRUE;
- bIncludeHelp = TRUE;
- szMsg = "Select the components that you wish to install.\n"+
- "If the check box is unchecked, that component will not be "+
- "installed. Click Next to continue with the installation.";
-
- nResult = AskOptions( NONEXCLUSIVE, szMsg,
- "Application Program Files", bIncludeProgram,
- "Sample and Template Files", bIncludeSamples,
- "On-Line Help Files", bIncludeHelp );
-
- if ( nResult = BACK ) then goto DetermineUserSelection; endif;
-
- // Handle user clicking Cancel button.
- if (nResult = CANCEL) then
- if (AskYesNo( "Are you sure you would like to exit setup?", NO ) = YES) then
- abort;
- else
- bReshowSetupType = TRUE;
- endif;
- endif;
- endswitch;
-
- if (bReshowSetupType = TRUE) then goto DetermineUserSelection; endif;
-
- // Check to see if target system meets space requirements.
- bSpaceOk = CheckSpaceRequirements( bIncludeSamples,
- bIncludeProgram,
- bIncludeHelp,
- svMainDirectory );
-
- // Ask user to try again if not enough space available.
- if (bSpaceOk = FALSE) then goto DetermineUserSelection; endif;
-
- FolderSelection:
- svGrp = PROGRAM_GROUP_NAME;
-
- // Allow user to modify folder name.
- if ( SelectFolder( "", svGrp, svGrp ) = BACK ) then
- goto DetermineUserSelection;
- endif;
-
- FileTransferSetup:
-
- // Prepare InstallShield to record deinstallation information.
- DeinstallStart( svMainDirectory, svUninstLogFile, UNINSTALL_KEY, 0 );
- RegDBSetItem( REGDB_UNINSTALL_NAME, APP_NAME );
-
- // Set registry App Paths key information for the main application.
- szAppPath = svMainDirectory ^ "PROGRAM" + ";" + szAppSharedDir;
- RegDBSetItem( REGDB_APPPATH, szAppPath );
- szProgram = svMainDirectory ^ "cgistar.exe";
- RegDBSetItem( REGDB_APPPATH_DEFAULT, szProgram );
-
- // Define the "General" file set.
- szFileSet = "General";
- TARGETDIR = svMainDirectory;
-
- FileSetBeginDefine( szFileSet );
-
- SetStatusWindow( -1, "Copying program files..." );
-
- // Always copy README & related files, located at
- // the root level in the DATA.Z library file.
- CompressGet( "data.z", "*.*", COMP_NORMAL );
- bIncludeProgram = TRUE;
- /*
- if (bIncludeProgram) then
- TARGETDIR = svMainDirectory ^ "PROGRAM";
- CompressGet( "data.z", "program\\*.*", INCLUDE_SUBDIR );
- CompressGet( "data.z", "shared\\*.*", COMP_NORMAL );
- TARGETDIR = szAppSharedDir;
- CompressGet( "data.z", "shared\\*.*", SHAREDFILE | COMP_NORMAL );
- endif;
-
- if (bIncludeSamples) then
- TARGETDIR = svMainDirectory ^ "SAMPLES";
- CompressGet( "data.z", "samples\\*.*", INCLUDE_SUBDIR );
- endif;
-
- if (bIncludeHelp) then
- TARGETDIR = svMainDirectory ^ "TEMPLATE";
- CompressGet( "data.z", "template\\*.*", INCLUDE_SUBDIR );
- endif;
- */
- FileSetEndDefine( szFileSet );
-
- DoFileTransfer:
- // Set up progress indicator and information gauge.
- Enable( STATUSDLG );
- StatusUpdate( ON, 90 );
-
- // Perform the file set.
- nResult = FileSetPerformEz( szFileSet, 0 );
-
- switch (nResult)
-
- case FS_DONE: // Successful completion.
-
- case FS_CREATEDIR: // Create directory error.
- MessageBox( "Unable to create a directory under " + TARGETDIR + "."+
- "Please check write access to this directory.", SEVERE );
- abort;
-
- default: // Group all other errors under default label.
- NumToStr( szTemp, nResult );
- MessageBox( "General file transfer error."+
- "Please check your target location and try again."+
- "\n\n Error Number:"+szTemp, SEVERE );
-
- abort;
- endswitch;
-
- SetRegistryEntries:
-
- CreateRegDBEntries( );
-
- Delay(2);
- Disable( STATUSDLG );
-
- // Create program groups (folders) and icons.
-
- CreateFolderIcons:
- SetStatusWindow( 95, "Creating Folder and Icons...." );
-
- CreateProgramFolder( svGrp );
- ShowProgramFolder( svGrp, SW_SHOW );
- LongPathToShortPath( svMainDirectory );
- Delay(1);
-
-
- TARGETDIR = svMainDirectory;
-
- if (bIncludeProgram) then
- szProgram = TARGETDIR ^ "cgistar.exe";
- if (bShellExplorer) then
- LongPathToQuote( szProgram, TRUE );
- else
- LongPathToShortPath( szProgram );
- endif;
- AddFolderIcon( svGrp, "Example1",
- szProgram + TARGETDIR ^ "cgistar.exe",
- TARGETDIR ^ "PROGRAM",
- "", 0, "", REPLACE );
- /*
- AddFolderIcon( svGrp, APP_NAME, szProgram,
- TARGETDIR ^ "PROGRAM",
- "", 0, "", REPLACE );
- */
- Delay( 1 );
- endif;
-
- if (bIncludeSamples) then
- szProgram = TARGETDIR ^ "PROGRAM\\cgistar.exe";
- if (bShellExplorer) then
- LongPathToQuote( szProgram, TRUE );
- else
- LongPathToShortPath( szProgram );
- endif;
- AddFolderIcon( svGrp, "Example1",
- szProgram + TARGETDIR ^ "cgistar.exe",
- TARGETDIR ^ "PROGRAM",
- "", 0, "", REPLACE );
- Delay( 1 );
- AddFolderIcon( svGrp, "Example2",
- szProgram + TARGETDIR ^ "cgistar.exe",
- TARGETDIR ^ "PROGRAM",
- "", 0, "", REPLACE );
- Delay( 1 );
- endif;
-
- AddFolderIcon( svGrp, "ReadmeFile",
- "NOTEPAD.EXE " + TARGETDIR ^ "cgistar.txt",
- TARGETDIR,
- "", 0, "", REPLACE );
- Delay( 1 );
-
-
- if (!bShellExplorer) then
- szProgram = WINDIR ^ "UNINST.EXE";
- LongPathToShortPath( szProgram );
- LongPathToShortPath( svUninstLogFile );
- AddFolderIcon( svGrp, "unInstallShield",
- szProgram + " -f" + svUninstLogFile,
- WINDIR,
- "", 0, "", REPLACE );
- Delay( 1 );
- endif;
-
- // Announce setup complete and offer to read README file.
-
- SetStatusWindow( 100, "Installation complete." );
-
- // If shared files could not be installed, then users must restart system.
- if (BATCH_INSTALL = TRUE) then
- szMsg = "Some files could not be installed because they are "+
- "currently in use by other programs in the system. "+
- "To allow for proper operation of the new program you should restart"+
- "your system at this time.";
- CommitSharedFiles(0);
- RebootDialog( "Restart Windows", szMsg, SYS_BOOTMACHINE );
- else
-
- szMsg = "Setup is complete. You may run the installed program ";
- if ( !bShellExplorer ) then
- szMsg = szMsg + STR_COMPLETENT;
- else
- szMsg = szMsg + STR_COMPLETE95;
- endif;
-
- MessageBeep( 0 );
- MessageBox( szMsg, INFORMATION );
- endif;
-
- exit;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: SetupScreen
- *
- * Purpose: This function will set up the screen look. This includes
- * colors, fonts, text to be displayed, etc.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function SetupScreen()
- begin
-
- Enable( INDVFILESTATUS );
-
- SetTitle( APP_NAME + " Setup", 28, WHITE );
-
- SetTitle( "Setup", 0, BACKGROUNDCAPTION ); // Caption bar text.
-
- Enable( BACKGROUND );
-
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckRequirements
- *
- * Purpose: This function will check all minimum requirements for the
- * application being installed. If any fail, then the user
- * is informed and the installation is terminated.
- *
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function CheckRequirements()
- number nvDx, nvDy;
- number nvResult;
- STRING szResult;
- BOOL bWin95;
- begin
-
- bShellExplorer = FALSE;
-
- // Assume that IS is running on Windows 95
- bWinNT = FALSE;
- bWin95 = TRUE;
-
- // Determine if target system uses NT or Windows 95.
- GetSystemInfo( OS, nvResult, szResult );
- if( nvResult = IS_WINDOWSNT ) then
- bWinNT = TRUE;
- bWin95 = FALSE;
- endif;
-
- // Get OSMAJOR. IF it is Greater than/Equal to 4 OR
- // if operating system InstallShield is running on
- // is Windows 95, the shell interface is being used.
-
- GetSystemInfo( OSMAJOR, nvResult, szResult );
- if( ( nvResult >= 4 ) || ( bWin95 ) ) then
- bShellExplorer = TRUE;
- endif;
-
- // Check screen resolution.
- GetExtents( nvDx, nvDy );
- if (nvDy < 480) then
- MessageBox( "This program requires VGA or better resolution.", WARNING );
- exit;
- endif;
-
- end;
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CheckSpaceRequirements
- *
- * Purpose: This function will check space requirements based on the
- * elements being installed.
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function CheckSpaceRequirements( bIncludeSamples,
- bIncludeProgram,
- bIncludeHelp,
- szDir )
- number nSizeRequired;
- begin
-
- nSizeRequired = 0;
-
- // Determine total size.
- if (bIncludeSamples) then
- nSizeRequired = nSizeRequired + SIZE_REQ_SAMPLES;
- endif;
-
- if (bIncludeHelp) then
- nSizeRequired = nSizeRequired + SIZE_REQ_TEMPLATES;
- endif;
-
- if (bIncludeProgram) then
- nSizeRequired = nSizeRequired + SIZE_REQ_PROGRAM;
- endif;
-
- // Check space on target drive.
- bSpaceOk = TRUE;
- if (GetDiskSpace( szDir ) < nSizeRequired) then
- szMsg = "There is not enough space available on the disk\n" +
- "'" + svMainDirectory + "' \n" +
- "Please free up some space or change the target location\n" +
- "to a different disk";
- MessageBeep(0);
- MessageBox( szMsg, WARNING );
- bSpaceOk = FALSE;
- endif;
-
- return bSpaceOk;
- end;
-
-
- /*---------------------------------------------------------------------------*\
- *
- * Function: CreateRegDBEntries
- *
- * Purpose: This function will create necessary keys and values for
- * the sample program.
- *
- * Input:
- *
- * Returns:
- *
- * Comments:
- \*---------------------------------------------------------------------------*/
-
- function CreateRegDBEntries()
- string szKey[255], szValue, szDemo, szProgram;
- begin
-
- RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
-
- // Create PRODUCT_KEY key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "DESIGNER";
- RegDBCreateKeyEx( szKey, "" );
-
- RegDBSetKeyValueEx( szKey, "Template", REGDB_STRING, "good.tpl", -1 );
- RegDBSetKeyValueEx( szKey, "TemplatePath", REGDB_STRING, svMainDirectory ^ "TEMPLATE", -1 );
- RegDBSetKeyValueEx( szKey, "x", REGDB_NUMBER, "2", -1 );
- RegDBSetKeyValueEx( szKey, "y", REGDB_NUMBER, "3", -1 );
- RegDBSetKeyValueEx( szKey, "dx", REGDB_NUMBER, "637", -1 );
- RegDBSetKeyValueEx( szKey, "dy", REGDB_NUMBER, "448", -1 );
- RegDBSetKeyValueEx( szKey, "LargeDraw", REGDB_NUMBER, "1", -1 );
- RegDBSetKeyValueEx( szKey, "PopupMenu", REGDB_NUMBER, "1", -1 );
- RegDBSetKeyValueEx( szKey, "NoPopup", REGDB_NUMBER, "1", -1 );
- RegDBSetKeyValueEx( szKey, "StartDialogValue", REGDB_NUMBER, "111", -1 );
- RegDBSetKeyValueEx( szKey, "TimeVisible", REGDB_NUMBER, "0", -1 );
-
- if (bIncludeSamples) then
- // Create "DEMOS" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "DEMOS";
- RegDBCreateKeyEx( szKey, "" );
-
- szDemo = svMainDirectory ^ "SAMPLES\\TOUR.DBD";
- szProgram = svMainDirectory ^ "PROGRAM\\DEMO32.EXE";
- RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, szDemo, -1 );
-
- szDemo = svMainDirectory ^ "SAMPLES\\2MINUTE.DBD";
- RegDBSetKeyValueEx( szKey, "path1", REGDB_STRING, szDemo, -1 );
- RegDBSetKeyValueEx( szKey, "tour", REGDB_STRING, szDemo, -1 );
-
- RegDBSetKeyValueEx( szKey, "exe", REGDB_STRING, szProgram, -1 );
- RegDBSetKeyValueEx( szKey, "active", REGDB_STRING, "Play", -1 );
-
- endif;
-
- // Create "HELPMENU" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "HELPMENU";
- RegDBCreateKeyEx( szKey, "" );
-
- RegDBSetKeyValueEx( szKey, "MaxNum", REGDB_NUMBER, "1", -1 );
-
- RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, svMainDirectory ^ "README.TXT", -1 );
- RegDBSetKeyValueEx( szKey, "exe0", REGDB_STRING, "NOTEPAD.EXE", -1 );
- RegDBSetKeyValueEx( szKey, "active0", REGDB_STRING, "Read Me", -1 );
-
- // Create "MRU" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "MRU";
- RegDBCreateKeyEx( szKey, "" );
-
- szDemo = svMainDirectory ^ "SAMPLES\\2MINUTE.DBD";
- RegDBSetKeyValueEx( szKey, "path0", REGDB_STRING, szDemo, -1 );
-
- // Create "SceneEditor" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "SceneEditor";
- RegDBCreateKeyEx( szKey, "" );
-
- RegDBSetKeyValueEx( szKey, "x", REGDB_NUMBER, "453", -1 );
- RegDBSetKeyValueEx( szKey, "y", REGDB_NUMBER, "2", -1 );
- RegDBSetKeyValueEx( szKey, "Visible", REGDB_NUMBER, "1", -1 );
-
- // Create "ToolPalette" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "ToolPalette";
- RegDBCreateKeyEx( szKey, "" );
-
- RegDBSetKeyValueEx( szKey, "x", REGDB_NUMBER, "509", -1 );
- RegDBSetKeyValueEx( szKey, "y", REGDB_NUMBER, "155", -1 );
- RegDBSetKeyValueEx( szKey, "Visible", REGDB_NUMBER, "1", -1 );
-
- // Create "AlignPalette" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "AlignPalette";
- RegDBCreateKeyEx( szKey, "" );
-
- RegDBSetKeyValueEx( szKey, "Visible", REGDB_NUMBER, "0", -1 );
-
- // Create "Controller" key.
- szKey = "SOFTWARE\\" + COMPANY_NAME + "\\" + PRODUCT_NAME + "\\" +
- PRODUCT_VERSION + "\\" + "Controller";
- RegDBCreateKeyEx( szKey, "" );
-
- RegDBSetKeyValueEx( szKey, "x", REGDB_NUMBER, "420", -1 );
- RegDBSetKeyValueEx( szKey, "y", REGDB_NUMBER, "231", -1 );
- RegDBSetKeyValueEx( szKey, "Visible", REGDB_NUMBER, "1", -1 );
-
- end;
-